package engine.gameObject.model;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import engine.material.Material;
import engine.shader.Shader;

public class AnimatedModel extends Model {

	private Animation animation;
	
	public AnimatedModel(IntBuffer indexbuffer, FloatBuffer verticeBuffer,
			FloatBuffer normalBuffer, FloatBuffer texCoordBuffer,
			Material material, int texture, int collisionLevels) {
		super(indexbuffer, verticeBuffer, normalBuffer, texCoordBuffer, material,
				texture, collisionLevels);
	}

	@Override
	public void update(float timeElapsed) {
		animation.resetApply();
		animation.update(timeElapsed);
	}
	
	@Override
	public void renderImpl(Shader shader) {
		animation.resetUpdate();
		animation.apply(getShader() != null ? getShader() : shader);
		
		super.renderImpl(shader);
	}
}
